<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>${appname}-<c:if test="${!empty sessionScope._local_node_session}">${sessionScope._local_node_session.nodeName}-</c:if>${si:ctname("NET_TYPE",sessionScope._netType)}</title>
<%@ include file="/WEB-INF/view/common/css_js_ace.jsp"%>
<style type="text/css">
sample-table-1 tbody td{
  
}
</style>
<script type="text/javascript">
function mouseCoords(ev) 
{ 
	if(ev.pageX || ev.pageY){ 
	return {x:ev.pageX, y:ev.pageY}; 
	} 
	return { 
	x:ev.clientX + document.body.scrollLeft - document.body.clientLeft, 
	y:ev.clientY + document.body.scrollTop - document.body.clientTop 
	}; 
} 

function init(){
	$('.tipMe').tooltip({'placement':'top'});
	$("#sample-table-1 tbody td.mytip").mouseover(function(ev){
		if($(this).find("a").size()>0){
			ev= ev || window.event; 
			var mousePos = mouseCoords(ev); 
          var $point=$(this).find("a");
         console.log($point.offset());
         $("#roadInfo .popover-content").empty();
         var data=eval("("+$point.attr("data")+")");
         var recvSyscodes=(data.recvSyscode==null?"":data.recvSyscode.split(","));
         var recvSysnames=$.trim($point.find("span[name='recvSyscode']").text()).split(",");
         var recvNodecodes=(data.recvNodecode==null?"":data.recvNodecode.split(","));
         var recvNodenames=$.trim($point.find("span[name='recvNodecode']").text()).split(",");
         var sendSyscode=data.sendSyscode;
         var sendNodecode=data.sendNodecode;
         for(var i=0;i<recvSyscodes.length;i++){
        	 var recvNodecode=null;
        	 if(recvNodecodes[i] && recvNodenames[i]){
        		 recvNodecode=recvNodenames[i];
        	 }else{
        		 if(recvNodecodes[i]){
        			 recvNodecode=recvNodecodes[i]
        		 }else{
        			 recvNodecode="";
        		 }
        	 }
        	 var recvSyscode=recvSysnames[i];
        	 $("#roadInfo .popover-content").append("<span  title='发送适配器'  class='tipMe fa fa-puzzle-piece'>&nbsp;"+sendSyscode+"</span>");
        	 $("#roadInfo .popover-content").append("<span class='icon-arrow-right'></span>");
        	 $("#roadInfo .popover-content").append("<span  class='tipMe icon-desktop' title='发送节点'>&nbsp;"+sendNodecode+"</span>");
        	 $("#roadInfo .popover-content").append("<span class='icon-arrow-right'></span>");
        	 $("#roadInfo .popover-content").append(" <span  class='tipMe fa fa-cloud-download' title='刻盘'>&nbsp;刻盘</span>");
        	 $("#roadInfo .popover-content").append("<span class='icon-arrow-right'></span>");
        	 $("#roadInfo .popover-content").append("<span  class='tipMe icon-desktop' title='接收节点'>&nbsp;"+recvNodecode+"</span>");
        	 $("#roadInfo .popover-content").append("<span class='icon-arrow-right'></span>");
        	 $("#roadInfo .popover-content").append("<span  title='接收适配器'  class='tipMe fa fa-puzzle-piece'>&nbsp;"+recvSyscode+"</span>");
        	 $("#roadInfo .popover-content").append("<br/>");
         }
         
         $("#roadInfo").css("left",mousePos.x-$("#roadInfo").width()/2);
		 $("#roadInfo").css("top",mousePos.y);
		 $("#roadInfo").css("display","block");
		}
	}).mouseout(function(){
		if($(this).find("a").size()>0){
			$("#roadInfo").css("display","none");
		}
	});
	
	$("#sample-table-1 input").click(function(){
		var selectedSize=parseInt($("#selectedSize").html());
		if(this.id=='checkedAll'){
			if(this.checked){
				var $chkarry = $('#sample-table-1 input:checked').not($('#checkedAll'));
				var checkedSize=0;
				if($chkarry.size()>0){
					for(var i=0;i<$chkarry.size();i++){
						var fileSize=parseInt($($chkarry.get(i)).parents("tr").find("td[name='fileSize']").html());
						checkedSize=checkedSize+fileSize;
					}
					$("#selectedSize").html(selectedSize+checkedSize);
				}
			}else{
				$("#selectedSize").html("0");
			}
		}else{
			var fileSize=parseInt($(this).parents("tr").find("td[name='fileSize']").html());
			if(this.checked){
				$("#selectedSize").html(selectedSize+fileSize);
			}else{
				$("#selectedSize").html(selectedSize-fileSize);
			}
		}
	});
}
$(function(){
	$("groupMsg").toggle(
	  function () {
	    $(this).addClass("selected");
	  },
	  function () {
	    $(this).removeClass("selected");
	  }
	);
	init();
	
});
function search(form) {
	$(form).appendPagerParaStr();
	return true;
}

function deleteById(id){
	ui.confirm('确认删除?',function(){
		 $.ajax({
			   type: "POST",
			   dataType:"json",
			   cache: false,
			   url: _ctx + "/monitor/send_cm_data_delete.do",
			   data: {id:id},
			   success: function(resp){
				   if(resp.status == '1'){
					   ui.msg(resp.msg, 1);
					   ui.go(_ctx + '/monitor/send_cm_data_list.do');
				   }else{
					   ui.msg(resp.msg, 0);
				   }
			   },
			   error:function(){
				   ui.msg('信息加载错误', 0);
			   }
		}); 
	});	
}
/**
 * 刻盘
 */
function carvedDiscs(id){
	var isSlected = checkAll.isChecked();
	if(!isSlected){
		ui.msg('请至少选择一条要删除的记录!');
		return;
	}
	var ids = checkAll.getIdsAsArr();
	window.location= _ctx + "/monitor/carved_discs_manage_carvedDiscs.do?id="+ids;
}


function deleteByBatch(){
	var isSlected = checkAll.isChecked();
	if(!isSlected){
		ui.msg('请至少选择一条要删除的记录!');
		return;
	}
	var ids = checkAll.getIdsAsArr();
	ui.confirm('确认删除?',function(){
		$.ajax({
			   type: "POST",
			   dataType:"json",
			   cache: false,
			   url: _ctx + "/monitor/send_cm_data_deletes.do",
			   traditional: true,
			   data:{ids:ids},
			   success: function(resp){
				   if(resp.status == '1'){
					   ui.msg(resp.msg, 1);
					   ui.go(_ctx + '/monitor/send_cm_data_list.do');
				   }else{
					   ui.msg(resp.msg, 0);
				   }
			   },
			   error:function(){
				   ui.msg('信息加载错误', 0);
			   }
		});
	}); 
}

/**
 * 异步加载子消息
 */
function showSubMsg(id,obj){
	var obj = $(obj);
	var shown = obj.attr("shown");
	var loaded = obj.attr("loaded");
	if('nop' == shown){
		if('nop' == loaded){
			$.ajax({
				   type: "GET",
				   dataType:"html",
				   cache: false,
				   url: _ctx + "/monitor/send_cm_data_submsg.do",
				   data:{id:id},
				   success: function(content){
					   $('#msg_'+id).after(content);
					   obj.attr("loaded","yeap");
				   },
				   error:function(){
					   ui.msg('信息加载错误', 0);
				   }
			});
		}
		$('tr[id^="submsg_'+id+'"]').show();
		obj.html('<i class="icon-chevron-up bigger-130"></i>');
		obj.attr("shown","yeap");
	}else{
		obj.attr("shown","nop");
		obj.html('<i class="icon-chevron-down bigger-130"></i>');
		
		$('tr[id^="submsg_'+id+'"]').hide();
	}
}

function getHtml(){
	 $.ajax({
		   type: "POST",
		   dataType:"html",
		   cache: false,
		   url: _ctx + "/monitor/carved_discs_manage_list.do",
		   success: function(resp){
			   $("#dropdown1").html(resp);
			   init();
		   },
		   error:function(){
			   ui.msg('信息加载错误', 0);
		   }
	}); 
}
function carvedData(){
	
	$.ajax({
		   type: "GET",
		   dataType:"html",
		   cache: false,
		   url: _ctx + "/monitor/send_cm_data_submsg.do",
		   data:{id:id},
		   success: function(content){
			   $('#msg_'+id).after(content);
			   obj.attr("loaded","yeap");
		   },
		   error:function(){
			   ui.msg('信息加载错误', 0);
		   }
	});
	alert("tt");
}
/* function detail(id){
	ui.box({
		title:'详细信息',
		size: 'lg',   //sm , lg
		remote:_ctx +'/monitor/send_cm_data_get.do',
		param:{id:id}
	});
} */
</script>
</head>
<body>
<%@ include file="/WEB-INF/view/common/topbar.jsp"%>
<div class="main-container" id="main-container">
	<div class="main-container-inner">
		<%@ include file="/WEB-INF/view/common/sidebar.jsp"%>
		<div class="main-content">
			<div class="breadcrumbs" id="breadcrumbs">
				<ul class="breadcrumb">
					<li>
						<i class="icon-home home-icon"></i>
						<a href="javascript:void(0);">首页</a>
					</li>
					<li>
						<a href="javascript:void(0);">数据交换监控</a>
					</li>
					<li>
						<a href="javascript:void(0);">待刻盘管理</a>
					</li>
					<li class="active">刻盘管理</li>
				</ul>
			</div>
			<div class="page-content">
			   <div class="row">
					    <div class="col-xs-12">
					         <div class="tabbable">
								<ul class="nav nav-tabs" id="myTab">
								   <li class="dropdown active">
										<a data-toggle="dropdown" class="dropdown-toggle" href="#">
											刻盘管理 &nbsp;
											<i class="icon-caret-down bigger-110 width-auto"></i>
										</a>
					
										<ul class="dropdown-menu dropdown-info">
											<li class="active">
												<a data-toggle="tab" href="#dropdown1" onclick="getHtml()">刻盘管理</a>
											</li>
					
											<li>
												<a data-toggle="tab" href="#dropdown2">历史刻盘记录</a>
											</li>
										</ul>
									</li>
									<li >
										<a data-toggle="tab" href="#home">
											<i class="green icon-home bigger-110"></i>
											上传管理
										</a>
									</li>
								</ul>
								<div class="tab-content">
								    
									<div id="dropdown1" class="tab-pane active">
										<p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade.</p>
									</div>
					
									<div id="dropdown2" class="tab-pane">
										<p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin.</p>
									</div>
									
									<div id="home" class="tab-pane in">
										home
									</div>
					
								</div><!-- tab-content -->
						 </div><!-- tabbable -->
					  </div><!-- col-xs-8 -->
				</div>
			</div>
		</div>
	</div>
</div>
<div class="popover fade bottom in" style="display: none;" id="roadInfo">
	<div class="arrow"></div>
	<h3 class="popover-title">一点多发路由</h3>
	<div class="popover-content"> Heads up! This alert needs your attention, but it's not super important.</div>
</div>

</body>
</html>
